#include <iostream>
#include <thread>
#include <mutex>

using namespace std;

void init()
{
    cout << "initialing..." << endl;
}

void worker(once_flag* flag)
{
    call_once(*flag, init);
}

void worker2()
{
    once_flag flag;
    call_once(flag, init);
}
int main()
{
    //once_flag flag;

    thread t1(worker2);
    thread t2(worker2);
    thread t3(worker2);
    thread t4(worker2);

    t1.join();
    t2.join();
    t3.join();
    t4.join();

    cout << "Hello World!" << endl;
    return 0;
}
